/** 
 * EventRegistry.cpp
 */
#include "EventRegistry.h"
#include <iostream>

using namespace std;

map<int,vector<const Listener*> > EventRegistry::sListenerMap;

void EventRegistry::registerListener(int inMessage, const Listener* inListener)
{
	sListenerMap[inMessage].push_back(inListener);
}

void EventRegistry::handleMessage(int inMessage)
{
	if(sListenerMap.find(inMessage) == sListenerMap.end() ) 
		return;
	for (unsigned int i=0; i < sListenerMap[inMessage].size(); i++) {
		sListenerMap[inMessage].at(i)->handleMessage(inMessage);
	}
}